<template>
  <div>
    <div id="container"  @dblclick="backMap" ></div>
    <!-- <LeftTop id="buttonright" style="transition: all 5s"></LeftTop> -->
    <NewLeftTop id="buttonright" style="transition: all 5s"></NewLeftTop>
    <LeftNext id="buttonrights" style="transition: all 5s"></LeftNext>
    <div @click="pande" id="rights">{{ intertext }}</div>
    <div id="buttonrightone" style="transition: all 5s">
      <Right />
    </div>
    <div @click="panderight" id="rightsjian">
      <span class="rightsjian2"> {{ intertextright }}</span>
    </div>
  </div>
</template>
<script>
import echarts from "echarts";
import "echarts/map/js/china.js"; // 引入中国地图数据
import MapData from "../components/anhui/MapData.json";
// import LeftTop from "../components/anhui/LeftTop/LeftTop";
import Right from "../components/anhui/pandect/right";
// import LeftNext from "../components/anhui/LeftNext/LeftNext";
import LeftNext from "../components/zujian/LeftNext.vue"
import NewLeftTop from '../components/anhui/NewLeftTop/NewLeftTop'
export default {
  components: {
    // LeftTop,
    Right,
    LeftNext,
    NewLeftTop,
  },
  data() {
    return {
      drawersright: true,
      intertextright: ">",
      drawers: true,
      intertext: "<",
    };
  },
  mounted() {
    this.MapData();
  },
  methods: {
     backMap(){
       this.$router.go(-1)
     },
    // 省份地图
    MapData() {
      var myChart = echarts.init(document.getElementById("container"));
      console.log(MapData);
      echarts.registerMap("安徽", MapData);
      var option = {
        tooltip: {
          show: true, //是否显示提示框组件，包括提示框浮层和 axisPointer。 [ default: true ]
          trigger: "item", //触发类型。 [ default: 'item' ]
          showDelay: 0,
          transitionDuration: 0.2,
          // formatter: function(params) {
          //   // alert(params);
          //   return params.name;
          // },
        },
        title: {
          text: "",
          x: "center",
        },
        geo: {
          map: "安徽",
          label: {
            normal: {
              show: true, //关闭省份名展示
              fontSize: "14",
              color: "rgba(0,0,0,0.7)",
            },
          },
          roam: true,
          // zoom:1.5,
          itemStyle: {},
        },
        series: [
          {
            type: "effectScatter",
            coordinateSystem: "geo",
            rippleEffect: {
              brushType: "stroke",
            },
            symbolSize: function(val, params) {
              return 8;
            },
            data: [],
          },
        ],
      };
      myChart.setOption(option);
      window.addEventListener("resize", function() {
        myChart.resize();
      });
      //绑定点击事件
      myChart.on("click", (param) => {
        // alert(param.name);
      });
    },
    // 右侧隐藏
    panderight() {
      // console.log(this.drawers);
      let rights = document.getElementById("rightsjian");
      let buttonright = document.getElementById("buttonrightone");
      if (this.drawersright) {
        this.drawersright = false;
        rights.innerText = "<";
        // this.intertextright = "<";
        rights.style.right = "40px";
        buttonright.style.opacity = 0;
        buttonright.style.transition = "all 0.5s";
        rights.style.transition = "all 0.5s";
        buttonright.style.zIndex=-99
      } else {
        // this.intertextright = "<";
        rights.innerText = ">";buttonright.style.zIndex=99
        this.drawersright = true;
        buttonright.style.opacity = 1;
        buttonright.style.transition = "all 0.5s";
        rights.style.right = "570px";
      }
    },
    // 左侧隐藏
    pande() {
      // console.log(this.drawers);
      let rights = document.getElementById("rights");
      let buttonright = document.getElementById("buttonright");
      let buttonrights = document.getElementById("buttonrights");
      if (this.drawers) {
        this.drawers = false;
        // this.intertext = ">";
        rights.innerText = ">";
        rights.style.left = "20px";
        buttonright.style.left = "-600px";
        buttonright.style.transition = "all 0.5s";
        buttonrights.style.left = "-600px";
        buttonrights.style.transition = "all 0.5s";
        rights.style.transition = "all 0.5s";buttonright.style.zIndex=-99;buttonrights.style.zIndex=-99;
      } else {
        // this.intertext = "<";
        rights.innerText = "<";
buttonright.style.zIndex=99;buttonright.style.zIndex=99;
        this.drawers = true;
        buttonright.style.left = "10px";
        buttonright.style.transition = "all 0.5s";
        buttonrights.style.left = "10px";
        buttonrights.style.transition = "all 0.5s";
        rights.style.left = "530px";
      }
    },
  },
};
</script>

<style lang="scss" scoped>
#container {
  width: 100%;
  height: 100vh;
  margin: 0 auto;
}
* {
  caret-color: transparent;
  -moz-user-select: none; /*火狐*/
  -webkit-user-select: none; /*webkit浏览器*/
  -ms-user-select: none; /*IE10*/
  -khtml-user-select: none; /*早期浏览器*/
  user-select: none;
}
.Index {
  position: relative;
  /* position: fixed; */
  flex-flow: wrap;
}
#buttonrightone {
  position: absolute;
  top: 11px;
  right: 42px;
  width: 515px;
}
#rightsjian {
  position: fixed;
  right: 573px;
  top: 48vh;
  width: 35px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  // background: rgb(253, 253, 253);
  cursor: pointer;

  font-size: 32px;
  font-weight: bolder;
  color: #999999;
  // box-shadow: 0px 0px 20px gainsboro;
}
#rightsjian::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  background: #fff;
  /* transform: perspective(.5em) rotateX(5deg); */
  transform: perspective(0.5em) rotateY(-12deg);
  background: -webkit-gradient(
    linear,
    0 0,
    0 bottom,
    from(#f3f5f7),
    to(#fdfeff)
  );
}
.rightsjian2 {
  display: inline-block;
}
.LeftTop {
  position: absolute;
  top: 20px;
  left: 19px;
}
.LeftBtn {
  position: absolute;
  top: 450px;
  left: 539px;
}
.LeftNext {
  position: absolute;
  top: 306px;
  left: 19px;
}
#rights {
  // box-shadow: 0px 0px 20px gainsboro;
  position: fixed;
  left: 534px;
  top: 48vh;
  width: 35px;
  height: 40px;
  line-height: 40px;
  text-align: center;
  // background: rgb(248, 245, 245);
  cursor: pointer;
  font-size: 32px;
  font-weight: bolder;
  color: #999999;
}
#rights::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  background: red;
  /* transform: perspective(.5em) rotateX(5deg); */
  transform: perspective(0.5em) rotateY(12deg);
  background: -webkit-gradient(
    linear,
    0 0,
    0 bottom,
    from(#f3f5f7),
    to(#fdfeff)
  );
}
</style>
